package edu.java.texbooks.scjp.test04;

public class ExceptionTest01 {

    public static void main(String[] args) {

	// test 01
	/*
	 * try { System.out.println("Try some code"); return; } finally {
	 * System.out.println("Finally block print"); }
	 */

	// test 02
	int result = doSomething1();
	System.out.println("result= " + result);
	String getString = doSomething2();
	System.out.println("ResultString= " + getString);

    }

    public static int doSomething1() {
	int result = 0;
	try {
	    result = 100;
	    System.out.println("doSomething1(): Try some code");
	    return result;
	} finally {
	    result = result + 1;
	    System.out.println("doSomething1(): Finally block print");
	    // return result;
	}
    }

    public static String doSomething2() {

	String myString = new String();
	try {
	    myString = "Hello";
	    System.out.println("doSomething2(): Try some code");
	    return myString;
	} finally {
	    myString = "Bye";
	    System.out.println("doSomething2(): Finally block print");
	    // return myString;
	}
    }
    
    public static void doSomething3(){
	try{
	    System.out.println("doSomething3(): Try some code");
	}
//	catch(Exception e){
//	    
//	}
	finally{
	    
	}
	
	System.out.println("doSomething3(): Out of try construction");
    }
}
